﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%@ Import Namespace="OAclient.Common" %>

<script type="text/javascript">

    function showno()                      //隐藏层方法       
    {
        document.getElementById("doing").style.display = "none";
        document.getElementById("divLogin").style.display = "none";
    }


    function showfloat(id)              //根据屏幕的大小显示两个层        
    {
        var range = getrange();
        document.getElementById('doing').style.width = range.width + "px";
        document.getElementById('doing').style.height = range.height + "px";
        document.getElementById('doing').style.display = "block";
        document.getElementById("divLogin").style.display = "block";
        document.getElementById("sure").name = id;

    }

    function getrange()                   //得到屏幕的大小        
    {
        var height = document.documentElement.clientHeight;
        var width = document.documentElement.clientWidth;

        return { height: height, width: width };
    } 
</script>

<script type="text/javascript">
    $(function() {
        var options = {
            slide_all: false
        };
        $("#worktable_main").selfAccordion(options);
        tableSelectOrder("#worktable_main .table_style");
    });

    function addMrg() {
        var mrg_message = document.getElementById("mrg_message").value;
        var mrg_time = $("#wcdjmrg #mrg_time").val();
        var sure = document.getElementById("sure").name;
        //        alert(sure);
        $.ajax({
            type: "POST",
            url: "/Wcdj/MyTable",
            data: { "mrg_message": mrg_message, "mrg_time": mrg_time, "sure": sure
            },
            success: function(data) {
                $("#wcdjmrg #mytable").html(data);
                $("#sure").val("");
            }
        });
    }
</script>

<table id="my_table" border="0" width="100%" class="table_style" cellpadding="0"
    cellspacing="0">
    <thead>
        <tr>
            <th>
                登记人名称
            </th>
            <th>
                时间
            </th>
            <th>
                外出地点
            </th>
            <th>
                外出事由
            </th>
            <th>
                联系人
            </th>
            <th>
                电话
            </th>
            <th>
                出门时间
            </th>
            <th>
                预计返回时间
            </th>
            <th>
                实际返回时间
            </th>
            <th>
                备注
            </th>
            <th>
                管理
            </th>
        </tr>
    </thead>
    <tbody>
        <%
            System.Data.DataTable allInfo = ViewData["wcdj_Mrg"] as System.Data.DataTable;
            if (allInfo == null || allInfo.Rows.Count == 0)
            {
        %>
        <tr>
            <td colspan="0" style="text-align: center;">
                当前无数据！
            </td>
        </tr>
        <% }%>
        <%else
            {
                for (int i = 0; i < allInfo.Rows.Count; i++)
                {
        %>
        <tr>
            <td>
                <%=allInfo.Rows[i]["登记人名称"] %>
            </td>
            <td>
                <%=allInfo.Rows[i]["登记日期"]%>
            </td>
            <td>
                <%=allInfo.Rows[i]["外出地点"]%>
            </td>
            <td>
                <%=allInfo.Rows[i]["外出事由"]%>
            </td>
            <td>
                <%=allInfo.Rows[i]["联系人"]%>
            </td>
            <td>
                <%=allInfo.Rows[i]["电话"]%>
            </td>
            <td>
                <%=allInfo.Rows[i]["出门时间"]%>
            </td>
            <td>
                <%=allInfo.Rows[i]["预计返回时间"]%>
            </td>
            <td>
                <%if (allInfo.Rows[i]["实际返回时间"].ToString() == "")
                  {%>
                <%="至今未回" %>
                <%  } %>
                <%else
                    {%>
                <%=allInfo.Rows[i]["实际返回时间"]%>
                <%} %>
            </td>
            <td title='<%=allInfo.Rows[i]["备注"].ToString() %>'>
                <%=allInfo.Rows[i]["备注"].ToString().Length > 25 ? allInfo.Rows[i]["备注"].ToString().Remove(25) : allInfo.Rows[i]["备注"].ToString()%>
            </td>
            <td>
                <%if (allInfo.Rows[i]["管理记录"].ToString() == "")
                  {%>
                <input id="manage" name="<%=allInfo.Rows[i]["登记号"] %>" style="" type="button" value="管理这条记录"
                    onclick="showfloat(this.getAttribute('name'))" />
                <label id="<%=allInfo.Rows[i]["登记号"]%>">
                </label>
                <% } %>
                <%else
                    {%>
                <%=allInfo.Rows[i]["管理记录"] %>
                <%  } %>
                <!--这个是半透明层-->
                <div id="doing" style="filter: alpha(opacity=30); -moz-opacity: 0.3; opacity: 0.3;
                    background-color: #000; width: 100%; height: 100%; z-index: 1; position: absolute;
                    left: 0; top: 0; display: none; overflow: hidden;">
                </div>
                <!-- 这个是管理框的层 怎么写都行-->
                <div id="divLogin" style="border: solid 10px #898989; background: #fff; padding: 10px;
                    width: 300px; z-index: 2; position: absolute; display: none; top: 60%; left: 65%;
                    margin: -200px 0 0 -400px;">
                    <div style="padding: 3px 15px 3px 15px; text-align: center; vertical-align: middle;">
                        <table height="150px" style="margin: 20px 0px 20px 10px;">
                            <tr>
                                <td>
                                    管理意见
                                </td>
                                <td>
                                    <input name="mrg_message" type="text" id="mrg_message" />
                                    <input id="mrg_time" name="mrg_time" type="hidden" value="<%=DateTime.Now.ToString("yyyy-MM-dd HH:mm")%>"
                                        disabled="disabled" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                                <td>
                                    <input id="sure" name="" type="button" value=" 确 定 " onclick="showtxt();addMrg();showno();selectAllRecord();" />
                                    <input id="bttcancel" type="button" value=" 取 消 " onclick="showno();" />
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </td>
        </tr>
        <% } %>
        <% } %>
    </tbody>
</table>
<div id="pageLink">
    <%var pageInfo = ViewData["pageInfo"] as PagingInfo; %>
    <%if (pageInfo != null)
      {  %>
    <%=Ajax.PageLinks(pageInfo, index => Url.Action("MyTable", new
                {
                    page = index,
                    select_id=ViewData["searchclrid_wfcurtask"],
                    checked_sign= ViewData["wcdj_selectchecked"] ,
                    etime=ViewData["wcdj_etime"] ,
                    stime=ViewData["wcdj_stime"] ,
                }), new AjaxOptions { UpdateTargetId = "mytable" })%>
    <!--workarea-wcdj-2-->
    <%} %>
</div>
